package CreateExecutors;

import com.sun.security.jgss.GSSUtil;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class demo2 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(() -> System.out.println(Thread.currentThread().getName() + " ==> 正在执行"));

        executorService.execute(() -> System.out.println(Thread.currentThread().getName() + " ==> 正在执行"));

        executorService.execute(() -> System.out.println(Thread.currentThread().getName() + " ==> 正在执行"));

        executorService.execute(() -> System.out.println(Thread.currentThread().getName() + " ==> 正在执行"));

        executorService.execute(() -> System.out.println(Thread.currentThread().getName() + " ==> 正在执行"));

        System.out.println( ((ThreadPoolExecutor)executorService).getPoolSize());
    }
}
